﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WTwitter.Model.Framework;

namespace WTwitter.Model.UserData {
	public class TimelineSettingTemplate {
		public TimelineType Type { get; set; }
		public string DisplayName { get; set; }
		public string Description { get; set; }
		public Func<TimelineSetting> Generator { set; get; }

		public static TimelineSettingTemplate Public = new TimelineSettingTemplate() {
			Type = TimelineType.Public,
			DisplayName = "Public",
			Description = "Protectedされていないユーザーの発言を表示するタイムライン",
			Generator = () => {
				return new TimelineSetting() {
					Name = "Public",
					Url = "http://api.twitter.com/1/statuses/public_timeline.json",
					IsAuthRequired = false,
					UpdateInterval = 3,
					StartupReadCount = 50
				};
			}
		};

		public static TimelineSettingTemplate Home = new TimelineSettingTemplate() {
			Type = TimelineType.Home,
			DisplayName = "Home",
			Description = "自分自身の発言とフォローしている人の発言（RT含む）を表示するタイムライン",
			Generator = () => {
				return new TimelineSetting() {
					Name = "Home",
					Url = "http://api.twitter.com/1/statuses/home_timeline.json",
					IsAuthRequired = true,
					UpdateInterval = 5,
					StartupReadCount = 50,
				};
			}
		};

		public static TimelineSettingTemplate Friends = new TimelineSettingTemplate() {
			Type  = TimelineType.Friends,
			DisplayName = "Friends",
			Description = "自分自身の発言とフォローしている人の発言を表示するタイムライン",
			Generator = () => {
				return new TimelineSetting() {
					Name = "Friend",
					Url = "http://twitter.com/statuses/friends_timeline.json",
					IsAuthRequired = true,
					UpdateInterval = 5,
					StartupReadCount = 5
				};
			}
		};

		public static TimelineSettingTemplate User = new TimelineSettingTemplate() {
			Type = TimelineType.User,
			DisplayName = "User",
			Description = "自分の発言を表示するタイムライン",
			Generator = () => {
				return new TimelineSetting() {
					Name = "User",
					Url = "http://api.twitter.com/1/statuses/user_timeline.json",
					IsAuthRequired = true,
					UpdateInterval = 10,
					StartupReadCount = 30,
				};
			}
		};

		public static TimelineSettingTemplate Mentions = new TimelineSettingTemplate() {
			Type = TimelineType.Mentions,
			DisplayName = "Reply",
			Description = "@自分のIDが入っている発言を表示するタイムライン",
			Generator = () => {
				return new TimelineSetting() {
					Name = "Reply",
					Url = "http://api.twitter.com/1/statuses/mentions.json",
					IsAuthRequired = true,
					UpdateInterval = 5,
					StartupReadCount = 50,
				};
			}
		};

		public static TimelineSettingTemplate Favorites = new TimelineSettingTemplate() {
			Type = TimelineType.Favorites,
			DisplayName = "Favorites",
			Description = "Favoriteマークを付けた発言を表示するタイムライン",
			Generator = () => {
				return new TimelineSetting() {
					Name = "Favorite",
					Url = "http://api.twitter.com/1/favorites.json",
					IsAuthRequired = true,
					UpdateInterval = 10,
					StartupReadCount = 20,
				};
			}
		};

		public static TimelineSettingTemplate DirectMessage = new TimelineSettingTemplate() {
			Type = TimelineType.Messages,
			DisplayName = "DirectMessage(受信)",
			Description = "受信したDirectMessageを表示するタイムライン",
			Generator = () => {
				return new DirectMessageSetting() {
					Name = "Message",
					Url = "http://api.twitter.com/1/direct_messages.json",
					IsAuthRequired = true,
					UpdateInterval = 5,
					StartupReadCount = 50,
				};
			}
		};

		public static TimelineSettingTemplate DirectMessageSent = new TimelineSettingTemplate() {
			Type = TimelineType.MessagesSent,
			DisplayName = "DirectMessage(送信)",
			Description = "送信したDirectMessageを表示するタイムライン",
			Generator = () => {
				return new DirectMessageSetting() {
					Name = "SentMessage",
					Url = "http://api.twitter.com/1/direct_messages/sent.json",
					IsAuthRequired = true,
					UpdateInterval = 5,
					StartupReadCount = 50,
				};
			}
		};

		public static TimelineSettingTemplate Search = new TimelineSettingTemplate() {
			Type = TimelineType.Search,
			DisplayName = "Search",
			Description = "Search APIで検索した結果を表示するタイムライン",
			Generator = () => {
				var item = new SearchTimelineSetting();
				item.Name = "Search";
				item.UpdateInterval = 10;
				item.SearchText = "検索ワード（ANDは空白、ORはORでつなぐ）";
				item.IsAuthRequired = false;
				item.IsJapaneseOnly = true;
				return item;
			}
		};
	}
}
